#!/usr/bin/env bash

#
netstat -na|grep 7000
if [ $? -eq 0 ]; then
 echo "frps started"
else
 echo "frps not run"
 exit 1
fi

#web
echo "start web.."
netstat -na|grep 8443
if [ $? -eq 0 ]; then
 echo "web started"
else
 echo "web start..."
 /opt/csbit/web/bin/shutdown.sh

 cp -f ../../nginx/webpage/server-https.xml /opt/csbit/web/conf/server.xml
 /opt/csbit/web/bin/startup.sh
fi

#bin下的内容确保已经生成好
cp -f frpc.ini ../../bin/.

echo "start frpc..."
pushd ../../bin/
 ./frpc -c frpc.ini
popd

